﻿using System;
using System.Collections.Generic;
using SpiderMaster.AspNet.TradingSystem;
using SpiderMaster.NetApplication;

namespace SpiderMaster.AspNet.Management
{
    /// <summary> <see cref="OperatingSystemData"/> for the <see cref="TradingCenter"/>
    /// </summary>
    public sealed class TradingSystemData : OperatingSystemData
    {
        /// <summary> Initializes a new instance of the <see cref="TradingSystemData"/> class.
        /// </summary>
        public TradingSystemData()
        {
            ApplicationName = AspNetTradingCenter2010.Name;
            DataDirectory = AspNetTradingCenter2010.DataDirectory.Left(AspNetTradingCenter2010.DataDirectory.LastIndexOf("/")).Add("/");
            DownloadsDataDirectory = DataDirectory.Left(AspNetTradingCenter2010.DataDirectory.LastIndexOf("/")) + "_Downloads/";
            GalleryImportsDataDirectory = DataDirectory.Left(AspNetTradingCenter2010.DataDirectory.LastIndexOf("/")) + "_GalleryImports/";

            LocalSQLConnectionString = DefaultValues.SQLConnection;
            // HostedSQLConnectionString = "ENTER YOUR HOSTER OR PRODUCTION CONNECTION STRING HERE!!";

            ManagerEntries = new List<ManagerEntry>();

            SystemManager.Current.Install(this);
        }

        public string LocalSQLConnectionString;

        public string HostedSQLConnectionString;

        public DateTime LastNotificationSent;

        /// <summary> Manager Entries.
        /// </summary>
        public List<ManagerEntry> ManagerEntries;

        /// <summary> Manager Entry.
        /// </summary>
        public class ManagerEntry
        {
            /// <summary> Guid.
            /// </summary>
            public Guid Guid;

            /// <summary> Type.
            /// </summary>
            public Type Type;

            /// <summary> Title.
            /// </summary>
            public String Title;

            /// <summary> Description.
            /// </summary>
            public String Description;

            /// <summary> Enabled.
            /// </summary>
            public Boolean Enabled;

            /// <summary> Initializes a new Default instance of the <see cref="ManagerEntry"/> class.
            /// </summary>
            public ManagerEntry()
            {
                Guid = Guid.Empty;
                Type = null;
                Title = String.Empty;
                Description = String.Empty;
                Enabled = true;
            }
        }
    }
}